<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">











<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>NPanday - Project Dependencies</title>
    <style type="text/css" media="all">
      @import url("../../css/maven-base.css");
      @import url("../../css/maven-theme.css");
      @import url("../../css/site.css");
    </style>
    <link rel="stylesheet" href="../../css/print.css" type="text/css" media="print" />
          </head>
  <body class="composite">
    <div id="banner">
                  <a href="" id="bannerLeft">
    
                                            <img src="../.././images/NPanday.png" alt="" />
    
            </a>
                        <a href="http://www.codeplex.com/" id="bannerRight">
    
                                            <img src="../.././images/logo-home.png" alt="" />
    
            </a>
            <div class="clear">
        <hr/>
      </div>
    </div>
    <div id="breadcrumbs">
          
  

  
    
            
  
    
            <div class="xleft">
          
                <a href="http://npanday.codeplex.com/" class="externalLink">NPanday Home</a>
                &gt;
      
                <a href="../../">NPanday 1.2</a>
                  </div>
            <div class="xright">      
  

  
    
            
  
    
             Last Published: 22 Jun 2010
              &nbsp;| Version: 1.2
            </div>
      <div class="clear">
        <hr/>
      </div>
    </div>
    <div id="leftColumn">
      <div id="navcolumn">
           
  

  
    
            
  
    
                   <h5>General Info</h5>
            <ul>
              
    <li class="none">
                    <a href="../../index.html">NPanday Overview</a>
          </li>
              
    <li class="none">
                    <a href="../../release-notes.html">NPanday Release Notes</a>
          </li>
              
    <li class="none">
                    <a href="../../faqs.html">NPanday FAQs</a>
          </li>
              
    <li class="none">
                    <a href="../../faqs.html">NPanday Features</a>
          </li>
              
    <li class="none">
                    <a href="../../npanday.pdf">Documentation PDF</a>
          </li>
          </ul>
              <h5>User's Guide</h5>
            <ul>
              
    <li class="none">
                    <a href="../.././guide/index.html">Introduction</a>
          </li>
              
    <li class="none">
                    <a href="../.././guide/installation/index.html">Installation</a>
          </li>
              
    <li class="none">
                    <a href="../.././guide/vs/index.html">Visual Studio Add-in</a>
          </li>
              
    <li class="none">
                    <a href="../.././guide/maven/index.html">Maven Command Line</a>
          </li>
              
    <li class="none">
                    <a href="../.././guide/devinfra/index.html">Maven Development Infrastructure</a>
          </li>
              
    <li class="none">
                    <a href="../../plugins/index.html">NPanday Plugins</a>
          </li>
          </ul>
              <h5>Contributing</h5>
            <ul>
              
    <li class="none">
                    <a href="../.././developers/index.html">Developer's Guide</a>
          </li>
              
    <li class="none">
                    <a href="../.././issue-tracking.html">Issue Tracking</a>
          </li>
              
    <li class="none">
                    <a href="../.././mail-lists.html">Mailing Lists</a>
          </li>
          </ul>
              <h5>Project Documentation</h5>
            <ul>
              
                
              
      
            
      
            
      
            
      
            
      
            
      
            
      
              
        <li class="collapsed">
                    <a href="../../project-info.html">Project Information</a>
                </li>
          </ul>
              <h5>Resources</h5>
            <ul>
              
    <li class="none">
                    <a href="http://maven.apache.org/" class="externalLink">Apache Maven</a>
          </li>
              
    <li class="none">
                    <a href="http://npanday.codeplex.com/" class="externalLink">NPanday on CodePlex</a>
          </li>
          </ul>
                                           <a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy">
            <img alt="Built by Maven" src="../../images/logos/maven-feather.png"></img>
          </a>
                       
  

  
    
            
  
    
        </div>
    </div>
    <div id="bodyColumn">
      <div id="contentBox">
        <div class="section"><h2>Project Dependencies</h2>
<p>This section defines the basic configuration of adding dependencies (otherwise known as <i>references</i>) into the project. To avoid runtime errors, make sure that the library to be loaded does not have conflicting instance(s) and/or is not yet loaded in the .NET Framework.</p>
<p>Dependency Types:</p>
<ul><li>normal - Local repository content artifacts that are added as dependencies.</li>
<li><tt>gac_msil</tt> - Artifacts that are installed in the GAC and used as references. Configuration similar to the following is used, <tt> &lt;type&gt;gac_msil&lt;/type&gt; </tt></li>
<li><tt>system</tt> - Artifact references to standard framework namespaces. Configuration similar to the following is added, <tt> &lt;scope&gt;system&lt;/scope&gt; </tt> and the <tt> &lt;systemPath&gt;[path_to_library]&lt;/systemPath&gt; </tt></li>
<li><tt>com_references</tt> - Artifact references to Component Object Model that is installed in the system. Configuration similar to the following is used, <tt> &lt;type&gt;com_reference&lt;/type&gt; </tt></li>
</ul>
<div class="section"><h3>Adding Dependencies</h3>
<p>Adding dependencies follows the normal Maven pattern, using the NPanday packaging types. For example:</p>
<div class="source"><pre>&lt;dependency&gt;
  &lt;groupId&gt;NUnit&lt;/groupId&gt;
  &lt;artifactId&gt;NUnit.Framework&lt;/artifactId&gt;
  &lt;version&gt;2.2.8.0&lt;/version&gt;
  &lt;type&gt;library&lt;/type&gt;
&lt;/dependency&gt;</pre>
</div>
<p>These dependencies can also refer to other modules in a multi-module build, which will be installed in the local Maven repository before building the project that depends on them.</p>
<p>As mentioned above, the special type of <tt>gac_msil</tt> is available to refer to dependencies in the GAC.</p>
<p>For all other dependencies, they should be located in a remote artifact repository. NPanday offers a few dependencies in the repository <a class="externalLink" href="http://repo.npanday.org/archiva/repository/3rdparty/">http://repo.npanday.org/archiva/repository/3rdparty/</a>. More commonly however, you will establish and populate your own artifact repository as described in <a href="../devinfra/artifact-repository.html"> Setting up an Artifact Repository</a>.</p>
<div class="section"><h4>Installing an Artifact Locally</h4>
<p>If you are testing a new library and do not yet have it available in a remote artifact repository, you may wish to install it locally.</p>
<p>Use the following command:</p>
<div class="source"><pre>mvn npanday.plugin:maven-install-plugin:install-file -Dfile=[path_to_file] \
  -DgroupId=[group_id] -DartifactId=[artifact_id] -DartifactVersion=[version] \
  -Dpackaging=[packaging_type]</pre>
</div>
<p>and supply appropriate values:</p>
<ul><li><b>file</b>: the location of the file to be installed.</li>
<li><b>groupId</b>: the groupId of the file.</li>
<li><b>artifactId</b>: artifact name of the file.</li>
<li><b>artifactVersion</b>: the version of file.</li>
<li><b>packaging</b>: the type of file to be installed.</li>
</ul>
</div>
</div>
<div class="section"><h3>Adding System Scope Dependencies</h3>
<p>To add a system scope dependency, add a configuration similar to the following in the project's <tt>pom.xml</tt>:</p>
<div class="source"><pre>&lt;dependency&gt;
  &lt;groupId&gt;artifact_group_id&lt;/groupId&gt;
  &lt;artifactId&gt;my.lib&lt;/artifactId&gt;
  &lt;version&gt;2.2&lt;/version&gt;
  &lt;type&gt;library&lt;/type&gt;
  &lt;scope&gt;system&lt;/scope&gt;
  &lt;systemPath&gt;C:\path\to\your\library.dll&lt;/systemPath&gt;
&lt;/dependency&gt;</pre>
</div>
<p>Supply the proper values for the dependency's <tt>&lt;groupId&gt;</tt>, <tt>&lt;artifactId&gt;</tt>, <tt>&lt;version&gt;</tt>, <tt>&lt;type&gt;</tt>, <tt>&lt;scope&gt;</tt>, and <tt>&lt;systemPath&gt;</tt>. Exact match of <tt>artifactId</tt> and <tt>version</tt> are required when manually adding dependencies into the project's <tt>pom.xml</tt>.</p>
<p>Note that in general system dependencies are not recommended as they may be located elsewhere on a different machine. If they are required, you may mitigate this problem by using a property value that can be set differently on another system:</p>
<div class="source"><pre>&lt;dependencies&gt;
  [...]
  &lt;dependency&gt;
    &lt;groupId&gt;artifact_group_id&lt;/groupId&gt;
    &lt;artifactId&gt;my.lib&lt;/artifactId&gt;
    &lt;version&gt;2.2&lt;/version&gt;
    &lt;type&gt;library&lt;/type&gt;
    &lt;scope&gt;system&lt;/scope&gt;
    &lt;systemPath&gt;${some.property}\library.dll&lt;/systemPath&gt;
  &lt;/dependency&gt;
  [...]
&lt;/dependencies&gt;
[...]
&lt;properties&gt;
  &lt;some.property&gt;C:\path\to\your&lt;/some.property&gt;
&lt;/properties&gt;</pre>
</div>
<p>The other system can then override it with <tt>mvn -Dsome.property=c:\another\path ...</tt> or by adding it to Maven's <tt>settings.xml</tt> file.</p>
</div>
</div>

      </div>
    </div>
    <div class="clear">
      <hr/>
    </div>
    <div id="footer">
      <div class="xright">&#169;  
          2010
    
          NPanday
          
  

  
    
            
  
    
  </div>
      <div class="clear">
        <hr/>
      </div>
    </div>
  </body>
</html>
